| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Static Public Member Functions | List of all members
nkGraphics::RenderQueue Class Reference

A render queue, where all items that have to be rendered are queued. More...

Inheritance diagram for nkGraphics::RenderQueue:

## Public Member Functions
virtual | ~RenderQueue ()
virtual Buffer * | getAccelerationStructureBuffer () const
System * | getSystem () const
nkMemory::StringView | getName () const
bool | getRaytraced () const
bool | getHidden () const
Entity * | getEntity (unsigned int index) const
unsigned int | getEntityCount () const
RenderStrategy * | getRenderStrategy () const
virtual void | setName (nkMemory::StringView name)
virtual void | setRaytraced (bool value)
void | setRenderStrategy (RenderStrategy *value)
void | setHidden (bool value)
virtual Entity * | addEntity ()
virtual void | eraseEntity (Entity *ent)
virtual void | clearQueue ()
RenderCommandQueue | bakeRenderCommandQueue (Shader *shader=nullptr, bool transparent=false)
virtual void | updateEntityNode (Entity *ent, Node *oldNode)
virtual void | updateEntityRenderInfo (Entity *ent, EntityRenderInfo *oldInfo, EntityRenderInfo *newInfo)
virtual void | updateMesh (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Mesh *oldMesh, Mesh *newMesh)
virtual void | updateShader (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Shader *oldShader, Shader *newShader)
virtual void | updateShaderRaytracing (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Shader *oldShader, Shader *newShader)
virtual void | exportClassToTree (nkExport::Node *rootNode) override
virtual void | importClassFromTree (nkExport::Node *rootNode) override
Public Member Functions inherited from nkExport::Exportable
| Exportable () noexcept
virtual | ~Exportable ()

## Static Public Member Functions
static nkMemory::UniquePtr< RenderQueue > | create (System *system=nullptr)

## Detailed Description

A render queue, where all items that have to be rendered are queued.

A queue can allocate entities to render. The entities can be used as-is, or attached to a Node, using Entity::setParentNode(). When an object is attached to the graph, it enables it to work with the transformations from the graph system.

See RenderQueueManager::createOrRetrieve() or RenderQueue::create() for instantiation.

## Constructor & Destructor Documentation

## ◆ ~RenderQueue()

virtual nkGraphics::RenderQueue::~RenderQueue | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ getAccelerationStructureBuffer()

virtual Buffer* nkGraphics::RenderQueue::getAccelerationStructureBuffer | ( |  | ) | const
| virtual

Retrieves the acceleration structure's buffer. This buffer can be fed to shaders for raytracing. If raytracing is not supported, this buffer will be empty.

Returns
  The acceleration structure's buffer used.

## ◆ getSystem()

System* nkGraphics::RenderQueue::getSystem | ( |  | ) | const

Returns
  The system the resource lives in.

## ◆ getName()

nkMemory::StringView nkGraphics::RenderQueue::getName | ( |  | ) | const

Returns
  The name assigned.

## ◆ getRaytraced()

bool nkGraphics::RenderQueue::getRaytraced | ( |  | ) | const

Returns
  Whether the queue is marked as raytraced (true) or not (false).

## ◆ getHidden()

bool nkGraphics::RenderQueue::getHidden | ( |  | ) | const

Returns
  Whether the render queue is hidden from project exporting (true) or not (false).

## ◆ getEntity()

Entity* nkGraphics::RenderQueue::getEntity | ( | unsigned int | index | ) | const

Parameters

  index | The index of the entity to retrieve.

Returns
  The entity requested if available, nullptr else.

## ◆ getEntityCount()

unsigned int nkGraphics::RenderQueue::getEntityCount | ( |  | ) | const

Returns
  The number of entities currently in the queue.

## ◆ getRenderStrategy()

RenderStrategy* nkGraphics::RenderQueue::getRenderStrategy | ( |  | ) | const

Returns
  The currently used render strategy.

Remarks
  By default, this will be an instance of a DefaultRenderStrategy.

## ◆ setName()

virtual void nkGraphics::RenderQueue::setName | ( | nkMemory::StringView | name | ) |
| virtual

Parameters

  name | The name to set.

## ◆ setRaytraced()

virtual void nkGraphics::RenderQueue::setRaytraced | ( | bool | value | ) |
| virtual

Sets whether this queue should be raytraced. Raytraced queues will keep their acceleration structures updated as they change. Enable this only when needed.

Parameters

  value | If the queue should be raytraced (true) or not (false).

## ◆ setRenderStrategy()

void nkGraphics::RenderQueue::setRenderStrategy | ( | RenderStrategy * | value | ) |

Sets the strategy to use when rendering a pass using the render queue.

Parameters

  value | The strategy to use, nullptr to reset to the default strategy.

Remarks
  Ownership of provided object remains in the hands of the client code, the render queue won't delete it.

## ◆ setHidden()

void nkGraphics::RenderQueue::setHidden | ( | bool | value | ) |

Sets whether the render queue should be hidden from the project exporting functions.

Parameters

  value | If it should be hidden (true) or not (false).

## ◆ addEntity()

virtual Entity* nkGraphics::RenderQueue::addEntity | ( |  | ) |
| virtual

Adds an entity into the queue.

Returns
  The entity allocated and added to the queue.

## ◆ eraseEntity()

virtual void nkGraphics::RenderQueue::eraseEntity | ( | Entity * | ent | ) |
| virtual

Erases and frees the memory of an entity.

Parameters

  ent | The entity to forget.

## ◆ clearQueue()

virtual void nkGraphics::RenderQueue::clearQueue | ( |  | ) |
| virtual

Clears the queue and makes it empty again.

## ◆ bakeRenderCommandQueue()

RenderCommandQueue nkGraphics::RenderQueue::bakeRenderCommandQueue | ( | Shader * | shader = `nullptr`,
|  | bool | transparent = `false`
| ) |  |

Translates the render queue into a command queue to render. Called by the MonoMaterialPass and RenderScenePass to eventually tansmit it to the renderer. This can also be called to check on custom strategies during their development time.

Parameters

  shader | A Shader to communicate as a parameter to the strategy, used by the MonoMaterialPass to provide its own shader.
  transparent | Whether the calling pass is flagged as transparent, or not.

Returns
  The command queue the strategy currently used provides back.

## ◆ updateEntityNode()

virtual void nkGraphics::RenderQueue::updateEntityNode | ( | Entity * | ent,
|  | Node * | oldNode
| ) |  |
| virtual

Updates called from registered objects. In theory, external code should not use it.

Parameters

  ent | The caller.
  oldNode | The node the entity updates from.

## ◆ updateEntityRenderInfo()

virtual void nkGraphics::RenderQueue::updateEntityRenderInfo | ( | Entity * | ent,
|  | EntityRenderInfo * | oldInfo,
|  | EntityRenderInfo * | newInfo
| ) |  |
| virtual

Update called from registered object. In theory, external code should not use it.

Parameters

  ent | The caller.
  oldInfo | The information the call updates from.
  newInfo | The new information the call updates to.

## ◆ updateMesh()

virtual void nkGraphics::RenderQueue::updateMesh | ( | Entity * | ent,
|  | EntityRenderInfoSlot * | slot,
|  | EntityRenderLodSlot * | lod,
|  | Mesh * | oldMesh,
|  | Mesh * | newMesh
| ) |  |
| virtual

Update called from registered object. In theory, external code should not use it.

Parameters

  ent | The caller.
  slot | The parent slot call is made from.
  lod | The LOD the call is made from.
  oldMesh | The mesh the call updates from.
  newMesh | The mesh the call updates to.

## ◆ updateShader()

virtual void nkGraphics::RenderQueue::updateShader | ( | Entity * | ent,
|  | EntityRenderInfoSlot * | slot,
|  | EntityRenderLodSlot * | lod,
|  | Shader * | oldShader,
|  | Shader * | newShader
| ) |  |
| virtual

Update called from registered object. In theory, external code should not use it.

Parameters

  ent | The caller.
  slot | The parent slot call is made from.
  lod | The LOD the call is made from.
  oldShader | The shader the call udpates from.
  newShader | The shader the call updates to.

## ◆ updateShaderRaytracing()

virtual void nkGraphics::RenderQueue::updateShaderRaytracing | ( | Entity * | ent,
|  | EntityRenderInfoSlot * | slot,
|  | EntityRenderLodSlot * | lod,
|  | Shader * | oldShader,
|  | Shader * | newShader
| ) |  |
| virtual

Update called from registered object. In theory, external code should not use it.

Parameters

  ent | The caller.
  slot | The parent slot call is made from.
  lod | The LOD the call is made from.
  oldShader | The shader the call udpates from.
  newShader | The shader the call updates to.

## ◆ exportClassToTree()

virtual void nkGraphics::RenderQueue::exportClassToTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Exports an item into a tree describing its structure and its data.

Parameters

  rootNode | The node into which the object has to write its related information.

Implements nkExport::Exportable.

## ◆ importClassFromTree()

virtual void nkGraphics::RenderQueue::importClassFromTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Imports information from a tree which is supposed to describe its structure and data.

Parameters

  rootNode | The root node of the tree holding the information.

Implements nkExport::Exportable.

## ◆ create()

static nkMemory::UniquePtr<RenderQueue> nkGraphics::RenderQueue::create | ( | System * | system = `nullptr` | ) |
| static

Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.

Parameters

  system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used.

Returns
  The created resource instance.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/RenderQueues/RenderQueue.h